<template>
  <div class="execution">
    <basic-container>
      <avue-crud
        v-model="form"
        :permission="permissionList"
        v-bind="bindVal"
        v-on="onEvent"
        :page.sync="page"
      >
        <template slot="menuLeft">
          <el-button type="primary" size="small" @click="myAdd">添加</el-button>
          <el-button type="primary" size="small" @click="delBO">删除</el-button>
          <el-button type="primary" size="small" v-if="false" @click="handleExport"
            >导出</el-button
          >
          <el-button type="primary" size="mini" @click="submitData">加入报表差错</el-button>
        </template>
        <template slot="menu" slot-scope="scope">
          <el-button
            icon="el-icon-edit"
            :size="scope.size"
            :type="scope.type"
            v-if="scope.row.approvalStatus == '0' && tvmList.length<=100"
            @click.stop="myEdit(scope.row)"
            >编辑</el-button
          >
          <el-button
            icon="el-icon-edit"
            :size="scope.size"
            :type="scope.type"
            v-if="scope.row.approvalStatus == '0' && tvmList.length>100"
            @click.stop="coinEdit(scope.row)"
            >编辑硬币钱箱</el-button
          >
          <el-button
            icon="el-icon-edit"
            :size="scope.size"
            :type="scope.type"
            v-if="scope.row.approvalStatus == '0' && tvmList.length>100"
            @click.stop="paperEdit(scope.row)"
            >编辑纸币钱箱</el-button
          >
          <el-button
            icon="el-icon-view"
            :size="scope.size"
            :type="scope.type"
            @click.stop="myView(scope.row)"
            >预览</el-button
          >
          <el-button
            icon="el-icon-check"
            :size="scope.size"
            :type="scope.type"
            @click="openPastRecords(scope.row)"
            >查看历史记录</el-button
          >
        </template>
      </avue-crud>
    </basic-container>
    <open-dialog title="添加" :DialogVisible.sync="addVisableDialog">
      <el-form label-width="60px">
        <dynamic-crud
          title="补币金额明细"
          :data="tableDataDetail"
          :option="tableOptionDetail"
          :isShow="oneShow"
          :isCoinShow="oneCoinShow"
          :isPaperShow="onePaperShow"
          :rowOneButton="oneButton"
          :rowOneCoinButton="oneCoinButton"
          :rowOnePaperButton="onePaperButton"
          :addNew="rowNew"
          :rowAdd="rowAdd"
        >
        <!-- <template slot-scope="scope" slot="tvmCashBoxNum">
          <el-select  v-model="scope.row.tvmCashBoxNum" placeholder="请选择" style="width: 150px" filterable allowCreate 
          @visible-change="visibleSelect($event, scope.row)"
          >
          <template v-if="visibleState[scope.row.tvmCode]">
            <el-option
              v-for="(item,index) in tvmCashBoxNumList"
              :key="index"
              :label="item.cashboxCode"
              :value="item.cashboxCode">
            </el-option>
          </template>
          </el-select>
        </template> -->
        </dynamic-crud>
        <avue-form
          v-if="addVisableDialog"
          v-model="formAdd.supplementCurrency"
          :option="formOption"
          style="margin-bottom:40px;margin-top:40px;"
        ></avue-form>
        <div class="bottom-menu">
          <el-button type="primary" @click="save">保存</el-button>
          <el-button type="primary" @click="addVisableDialog = false"
            >取消</el-button
          >
        </div>
      </el-form>
    </open-dialog>
    <open-dialog title="编辑" :DialogVisible.sync="editVisableDialog">
      <el-form label-width="60px">
        <dynamic-crud
          title="补币金额明细"
          :data="tableDataDetail"
          :option="tableOptionDetail"
        >
          <!-- <template slot-scope="scope" slot="tvmCashBoxNum">
            <el-select  v-model="scope.row.tvmCashBoxNum" placeholder="请选择" style="width: 150px" filterable allowCreate 
            @visible-change="visibleSelect($event, scope.row)"
            >
            <template v-if="visibleState[scope.row.tvmCode]">
              <el-option
                v-for="(item,index) in tvmCashBoxNumList"
                :key="index"
                :label="item.cashboxCode"
                :value="item.cashboxCode">
              </el-option>
            </template>
            </el-select>
          </template> -->
        </dynamic-crud>
        <avue-form
          v-if="editVisableDialog"
          v-model="formAdd.supplementCurrency"
          :option="formOption"
          style="margin-bottom:40px;margin-top:40px;"
        ></avue-form>
        <div class="bottom-menu">
          <el-button type="primary" @click="edit">保存</el-button>
          <el-button type="primary" @click="editVisableDialog = false"
            >取消</el-button
          >
        </div>
      </el-form>
    </open-dialog>
    <open-dialog title="编辑硬币钱箱" :DialogVisible.sync="editCoinVisableDialog">
      <el-form label-width="60px">
        <dynamic-crud
          title="补币金额明细"
          :data="tableDataDetail"
          :option="tableOptionDetail"
        >
          <!-- <template slot-scope="scope" slot="tvmCashBoxNum">
            <el-select  v-model="scope.row.tvmCashBoxNum" placeholder="请选择" style="width: 150px" filterable allowCreate 
            @visible-change="visibleSelect($event, scope.row)"
            >
            <template v-if="visibleState[scope.row.tvmCode]">
              <el-option
                v-for="(item,index) in tvmCashBoxNumList"
                :key="index"
                :label="item.cashboxCode"
                :value="item.cashboxCode">
              </el-option>
            </template>
            </el-select>
          </template> -->
        </dynamic-crud>
        <avue-form
          v-if="editCoinVisableDialog"
          v-model="formAdd.supplementCurrency"
          :option="formOption"
          style="margin-bottom:40px;margin-top:40px;"
        ></avue-form>
        <div class="bottom-menu">
          <el-button type="primary" @click="editCoin">保存</el-button>
          <el-button type="primary" @click="editCoinVisableDialog = false"
            >取消</el-button
          >
        </div>
      </el-form>
    </open-dialog>
    <open-dialog title="编辑纸币钱箱" :DialogVisible.sync="editPaperVisableDialog">
      <el-form label-width="60px">
        <dynamic-crud
          title="补币金额明细"
          :data="tableDataDetail"
          :option="tableOptionDetail"
        >
          <!-- <template slot-scope="scope" slot="tvmCashBoxNum">
            <el-select  v-model="scope.row.tvmCashBoxNum" placeholder="请选择" style="width: 150px" filterable allowCreate 
            @visible-change="visibleSelect($event, scope.row)"
            >
            <template v-if="visibleState[scope.row.tvmCode]">
              <el-option
                v-for="(item,index) in tvmCashBoxNumList"
                :key="index"
                :label="item.cashboxCode"
                :value="item.cashboxCode">
              </el-option>
            </template>
            </el-select>
          </template> -->
        </dynamic-crud>
        <avue-form
          v-if="editPaperVisableDialog"
          v-model="formAdd.supplementCurrency"
          :option="formOption"
          style="margin-bottom:40px;margin-top:40px;"
        ></avue-form>
        <div class="bottom-menu">
          <el-button type="primary" @click="editPaper">保存</el-button>
          <el-button type="primary" @click="editPaperVisableDialog = false"
            >取消</el-button
          >
        </div>
      </el-form>
    </open-dialog>
    <open-dialog title="历史记录" :DialogVisible.sync="visableDialogRecords">
      <el-form label-width="60px">
        <avue-crud
          :data="tableDataRecords"
          :option="tableOptionRecords"
        >
          <template slot="menu" slot-scope="scope">
            <el-button
              icon="el-icon-check"
              :size="scope.size"
              :type="scope.type"
              @click="openRecordsDetail(scope.index)"
              >查看明细记录</el-button
            >
          </template>
        </avue-crud>
        <div class="bottom-menu">
          <el-button type="primary" @click="visableDialogRecords = false"
            >取消</el-button
          >
        </div>
      </el-form>
    </open-dialog>
    <open-dialog title="历史明细记录" :DialogVisible.sync="visableDialogRecordsDetail" width="60%">
      <el-form>
        <dynamic-crud
          title="补币金额明细"
          :data="tableDataRecordsDetail"
          :option="tableOptionRecordsDetail"
           :disabled="true"
        ></dynamic-crud>
        <div class="bottom-menu">
          <el-button @click="visableDialogRecordsDetail = false"
            >关闭</el-button
          >
        </div>
      </el-form>
    </open-dialog>
    <open-dialog title="预览" :DialogVisible.sync="viewVisableDialog">
      <el-form label-width="40px">
        <div class="header">补币金额明细</div>
        <avue-crud
          :data="tableDataDetail"
          :option="tableOptionDetailView"
        ></avue-crud>
        <avue-form
          v-if="viewVisableDialog"
          v-model="formAdd.supplementCurrency"
          :option="formOptionView"
          style="margin-bottom:40px;margin-top:40px;"
        ></avue-form>
        <div class="bottom-menu">
          <el-button type="primary" @click="viewVisableDialog = false"
            >取消</el-button
          >
        </div>
      </el-form>
    </open-dialog>
    <addReportEditor ref="addReportEditor" @addReportSuccess="getList"></addReportEditor>
  </div>
</template>

<script>
import baseCrud from "@/mixins/base-crud";
import { dateFormat } from "@/util/date.js";
import addReportEditor from '@/views/stationTiecketManager/xianWngCJXXQR/BBCCGG/BBCCGGSQ/Editor';
import {
  fetchList,
  getObj,
  getSupplementCoinDetails,
  getSupplementPaperDetails,
  addObj,
  putObj,
  coinPutObj,
  paperPutObj,
  delObj,
  delBatch,
  exportExcel,
  getTvmCode,
  getTvmSupplementCurrency,
  queryPastRecords,
  queryPastRecordsDetail,
  getTvmCashBoxNum,
  getPeriods
} from "@/api/subwaystm/swsttvmsupplementcurrency/swsttvmsupplementcurrency";
import {
  tableOption,
  formOption,
  formOptionView,
  tableOptionRecords
} from "@/const/crud/subwaystm/swsttvmsupplementcurrency/swsttvmsupplementcurrency";
import { tableOptionDetail,tableOptionRecordsDetail,tableOptionDetailView } from "@/const/crud/subwaystm/swsttvmsupplementcurrency/swsttvmsupplementcurrencydetails";
import transitUtil from "@/api/subwayRat/transitUtil";
import store from "@/store";
export default {
  name: "swsttvmsupplementcurrency",
  mixins: [
    baseCrud("subwaystm/swsttvmsupplementcurrency/swsttvmsupplementcurrency")
  ],
  components: {
    addReportEditor
  },
  data() {
    return {
      oneShow: true,
      oneCoinShow: false,
      onePaperShow: false,
      rowNew: true,
      tvmList: [],
      tvmCode: "",
      tableOptionDetail: tableOptionDetail,
      tableOptionDetailView: tableOptionDetailView,
      formOption: formOption,
      formOptionView: formOptionView,
      addVisableDialog: false,
      addchangeDialogFlag: false,
      editVisableDialog: false,
      editCoinVisableDialog: false,
      editPaperVisableDialog: false,
      editchangeDialogFlag: false,
      viewVisableDialog: false,
      viewchangeDialogFlag: false,
      formAdd: {
        supplementCurrency: {},
        details: []
      },
      searchForm:{
        approvalStatus:'0'
      },
      tableDataDetail: [],
      tableDataRecords: [],
      recordsId: [],
      tableDataRecordsDetail: [],
      tableOptionRecordsDetail: tableOptionRecordsDetail,
      visableDialogRecords: false,
      visableDialogRecordsDetail: false,
      tableOptionRecords: tableOptionRecords,
      mainId: 0,
      //tvmCashBoxNumList: [],
      //visibleState:{}
      settleDateAll:{
        startSettleDate:'',
        endSettleDate:''
      },
      selectKeys:[]
    };
  },

  computed: {
    permissionList() {
      return {
        addBtn: this.vaildData(
          this.permissions.swsttvmsupplementcurrency_add,
          false
        ),
        delBtn: this.vaildData(
          this.permissions.swsttvmsupplementcurrency_del,
          false
        ),
        editBtn: this.vaildData(
          this.permissions.swsttvmsupplementcurrency_edit,
          false
        )
      };
    }
  },
  beforeMount() {
    getTvmCode().then(res => {
      this.tvmList = res.data.data.records;
    });
  },
  created() {
    this.otherVueAction();
  },
  // mounted() {
  //     this.getTvmCashBoxNumList();
  // },
  methods: {
    // visibleSelect(param, row) {
    //   this.$set(this.visibleState, row.tvmCode, true);
    // },
    // getTvmCashBoxNumList(){
    //   let p={};
    //   p.stationCode=store.getters.userInfo.stationCode;
    //   p.size=-1;
    //   getTvmCashBoxNum(p).then(res=>{
    //       this.tvmCashBoxNumList=res.data.data.records;
    //   });
    // },
    async submitData() {
      if (this.$refs.crud.tableSelect.length < 1) {
        this.$message.error("请选择数据");
        return false;
      }
      if (this.$refs.crud.tableSelect.length != 1) {
        this.$message.error("只能选择一条数据");
        return false;
      }
      let params = {};
      let supplementTime = "";
      let res = false;
      let ress = false;
      for (const table of this.$refs.crud.tableSelect) {
        if (table.approvalStatus != "1") {
          this.$message.error("请选择已提交的数据");
          return false;
        }else{
          let now = new Date(table.supplementCurrencyTime);
          if(now.getHours()>=2){
            supplementTime = dateFormat(now).substring(0, 10);
          }else{
            let nows = new Date(now.setDate(now.getDate()-1));
            supplementTime = dateFormat(nows).substring(0, 10);
          }
          params = {
            lineCode: table.lineCode,
            stationCode: table.stationCode,
            revenueTime: supplementTime
          };
          this.getPeriods(params);
          if (table.isAddReprotError == "1") {
            res = await this.$confirm('该数据已加入报表差错，是否重新加入？', '提示', {
              confirmButtonText: '是',
              cancelButtonText: '否',
              type: 'warning'
            });
            if (!res) {
              return;
            }else{
              ress = true;
            }
          }
        }
      }
      if(res==false){
        ress = await this.$confirm("是否加入报表差错", "提示", {
          confirmButtonText: "确认",
          cancelButtonText: "取消",
          type: "warning"
        });
      }
      if (!ress) {
        return;
      }
      this.selectKeys = this.$refs.crud.tableSelect;
      let param={
        dialogTitle: "加入报表差错",
        diffAmountId:this.selectKeys[0].id,
        dataSourceTable:"sw_st_tvm_supplement_currency",
        lineCode:this.selectKeys[0].lineCode,
        stationCode:this.selectKeys[0].stationCode,
        //tvmCode:this.selectKeys[0].tvmCode,
        reprotTime:this.settleDateAll.endSettleDate,
        reportNameId:7,
        settleBeginTime:this.settleDateAll.startSettleDate,
        settleEndTime:this.settleDateAll.endSettleDate,
        userCodes:this.selectKeys[0].operatorId,
        showType:3,
        dataSource:1,
        page:this.page
      };
      this.$refs.addReportEditor.others_report_add_call(param);
    },
    async getPeriods(params){
      await getPeriods(params).then((res)=>{
        if(res!=""){
          let beginTime = res.data.beginTime;
          let endTime = res.data.endTime;
          let now = new Date(beginTime);
          let nows = new Date(endTime);
          this.settleDateAll.startSettleDate = dateFormat(now).substring(0, 10);
          this.settleDateAll.endSettleDate = dateFormat(nows).substring(0, 10);
        }
      });
    },
    handleCancle(){
      this.tableDataRecords =[];
      this.visableDialogRecords = fasle;
    },
    async queryPastRecords(row){
      let param={};
      let listRecords = [];
      param.id=row.id;
      var that = this
      await queryPastRecords(param)
        .then(res => {
          listRecords = res.data.data;
          for( var item of listRecords){
            this.tableDataRecords.push(item.logInfo);
            this.recordsId.push(item.id);
          }
        })
    },
    openPastRecords(row){
      this.tableDataRecords = [];
      this.queryPastRecords(row);
      this.visableDialogRecords=true;
    },
    async queryPastRecordsDetail(param){
      await queryPastRecordsDetail(param)
        .then(res => {
          this.tableDataRecordsDetail = res.data.data;
        })
    },
    openRecordsDetail(index){
      this.tableDataRecordsDetail = [];
      let param={};
      for(var i=0;i<this.recordsId.length;i++){
        if(i==index){
          param.id = this.recordsId[i];
          this.queryPastRecordsDetail(param);
        }
      }
      this.visableDialogRecordsDetail=true;
    },
    rowAdd: function(callback) {
      this.oneShow = false;
      this.oneCoinShow = false;
      this.onePaperShow = false;
      this.tableOptionDetail.column[2].cell = true;
      callback({
        tvmCode: this.tvmCode
      });
    },
    oneCoinButton: function(callback1) {
      this.rowNew = false;
      this.tableOptionDetail.column[2].cell = false;
      for (const item1 of this.tvmList) {
        const obj1 = Object.assign({}, item1);
        callback1(obj1);
      }
    },
    onePaperButton: function(callback2) {
      this.rowNew = false;
      this.tableOptionDetail.column[2].cell = false;
      for (const item2 of this.tvmList) {
        const obj2 = Object.assign({}, item2);
        callback2(obj2);
      }
    },
    delEditRow() {
      this.tableDataDetail.forEach(row => {
        let index = this.tableDataDetail.indexOf(row);
        this.tableDataDetail.splice(index, this.tableDataDetail.length);
      });
    },
    oneButton: function(callback) {
      this.rowNew = false;
      this.tableOptionDetail.column[2].cell = false;
      if (this.tableDataDetail.length > 0) {
        this.$confirm("此操作将重新生成, 是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          this.delEditRow();
          for (const item of this.tvmList) {
            const obj = Object.assign({}, item);
            for (let index = 0; index < 2; index++) {
              if (index) {
                obj.tvmCashBoxType = "2";
              } else {
                obj.tvmCashBoxType = "4";
              }
              obj.id = obj.id + index + "";
              callback(obj);
            }
          }
          // for (const item of this.tableDataDetail) {
          //   Object.keys(item).map(key => {
          //     if (key != "$cellEdit" && key != "tvmCode") {
          //       item[key] = undefined;
          //     }
          //   });
          // }
        });
      } else {
        for (const item of this.tvmList) {
          const obj = Object.assign({}, item);
          for (let index = 0; index < 2; index++) {
            if (index) {
              obj.tvmCashBoxType = "2";
            } else {
              obj.tvmCashBoxType = "4";
            }
            obj.id = obj.id + index + "";
            callback(obj);
          }
        }
      }
    },
    countMoney() {
      let money = +0;
      for (const item of this.tableDataDetail) {
        money += item.supplementAmount * 100;
      }
      this.formAdd.supplementCurrency.totalSupplementAmount = isNaN(money)
        ? "请输入补币金额"
        : money / 100 + "";
    },
    delBO: function() {
      if (this.$refs.crud.tableSelect.length < 1) {
        this.$message.error("请选择数据");
        return false;
      }
      let ids = [];
      for (const table of this.$refs.crud.tableSelect) {
        //      if ((table.dataSource == "1" && table.noticeStatus != "0")||((table.dataSource == "0"))){
        //           this.$message.error("请检查数据，只能删除自己提交的且未通知的");
        //     return false;
        //   }
        //     if (table.dataSource == "0" && table.noticeStatus == "0") {
        //       ids.push(table);
        //     }
        if (table.approvalStatus != "0") {
          this.$message.error("请选择未提交的数据");
          return false;
        }
        ids.push(table.id);
      }
      this.$confirm("确认删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        delBatch(ids)
          .then(data => {
            this.$message.success("删除成功");
            this.getList(this.page);
            done();
          })
          .catch(() => {
            loading();
          });
      });
    },
    save: function() {
      if (this.tableDataDetail.length == 0) {
        this.$message.info("请添加补币金额明细信息！");
        return;
      }
      for (const item of this.tableDataDetail) {
        if (
          item.tvmCode == null ||
          item.tvmCashBoxType == null ||
          item.supplementAmount == null
        ) {
          this.$message.info(
            "TVM编号、TVM钱箱类型、补币金额为必填项！不能为空"
          );
          return;
        }
        if(item.supplementAmount!==undefined){
          if(String(item.supplementAmount).length>5){
            this.$message.info("请检查补币金额不能超过5位数！");
            return;
          }
        }
      }
      this.formAdd.details = this.tableDataDetail;
      if (this.formAdd.supplementCurrency.operatorId == "") {
        this.$message.info("请选择操作人员！");
        return;
      }
      let now = new Date();
      let future = new Date();
      // let nowDate = new Date();
      // if (now.getHours() < 2) {
      //   dateFormat(now).substr(0, 10) + " 02:00:00";
      //   future.setDate(nowDate.getDate() + 1);
      // }else{
      //   future.setDate(nowDate.getDate() + 1);
      // }
      future.setDate(now.getDate() + 1);
      if(
        this.formAdd.supplementCurrency.supplementCurrencyTime >= dateFormat(future).substr(0, 10) + " 02:00:00" || 
        this.formAdd.supplementCurrency.supplementCurrencyTime < dateFormat(now).substr(0, 10) + " 02:00:00"
      ){
        this.$confirm("正常情况下无需修改补币时间，是否确认修改？", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          addObj(this.formAdd)
            .then(data => {
              this.$message.success("添加成功");
              this.getList(this.page);
              this.addVisableDialog = false;
              done();
            })
            .catch(() => {});
        })
      } else {
        addObj(this.formAdd)
          .then(data => {
            this.$message.success("添加成功");
            this.getList(this.page);
            this.addVisableDialog = false;
            done();
          })
          .catch(() => {});
      }
    },
    edit: function() {
      for (const item of this.tableDataDetail) {
        if (
          item.tvmCode == "" ||
          item.tvmCashBoxType == "" ||
          item.supplementAmount == ""
        ) {
          this.$message.info(
            "TVM编号、TVM钱箱类型、补币金额为必填项！不能为空"
          );
          return;
        }
      }
      if (this.formAdd.supplementCurrency.operatorId == null) {
        this.$message.info("请选择操作人员！");
        return;
      }
      this.formAdd.details = this.tableDataDetail;
      putObj(this.formAdd,"24")
        .then(data => {
          this.$message.success("修改成功");
          this.getList(this.page);
          this.editVisableDialog = false;
          done();
        })
        .catch(() => {});
    },
    editCoin: function() {
      for (const item of this.tableDataDetail) {
        if (
          item.tvmCode == "" ||
          item.tvmCashBoxType == "" ||
          item.supplementAmount == ""
        ) {
          this.$message.info(
            "TVM编号、TVM钱箱类型、补币金额为必填项！不能为空"
          );
          return;
        }
      }
      if (this.formAdd.supplementCurrency.operatorId == null) {
        this.$message.info("请选择操作人员！");
        return;
      }
      this.formAdd.details = this.tableDataDetail;
      coinPutObj(this.formAdd,"2")
        .then(data => {
          this.$message.success("修改成功");
          this.getList(this.page);
          this.editCoinVisableDialog = false;
          done();
        })
        .catch(() => {});
    },
    editPaper: function() {
      for (const item of this.tableDataDetail) {
        if (
          item.tvmCode == "" ||
          item.tvmCashBoxType == "" ||
          item.supplementAmount == ""
        ) {
          this.$message.info(
            "TVM编号、TVM钱箱类型、补币金额为必填项！不能为空"
          );
          return;
        }
      }
      if (this.formAdd.supplementCurrency.operatorId == null) {
        this.$message.info("请选择操作人员！");
        return;
      }
      this.formAdd.details = this.tableDataDetail;
      paperPutObj(this.formAdd,"4")
        .then(data => {
          this.$message.success("修改成功");
          this.getList(this.page);
          this.editPaperVisableDialog = false;
          done();
        })
        .catch(() => {});
    },
    myAdd: function() {
      this.tableDataDetail = [];
      //Object.keys(this.formAdd.supplementCurrency).map(key => {this.formAdd.supplementCurrency[key] =''})
      this.formAdd = {
        supplementCurrency: {},
        details: []
      };
      let now = new Date();
      if (now.getHours() < 2) {
        //now.setDate(now.getDate())
        this.formAdd.supplementCurrency.supplementCurrencyTime =
          dateFormat(now).substr(0, 10) + " 02:00:00";
      } else {
        this.formAdd.supplementCurrency.supplementCurrencyTime = dateFormat(
          now
        );
      }
      if(this.tvmList.length>100){
        this.oneShow = false;
        this.oneCoinShow = true;
        this.onePaperShow = true;
      }else{
        this.oneShow = true;
        this.oneCoinShow = false;
        this.onePaperShow = false;
      }
      this.rowNew = true;
      this.addVisableDialog = true;
    },
    myView: function(row) {
      getObj(row.id)
        .then(response => {
          let res = response.data.data;
          this.tableDataDetail = res.details;
          this.formAdd.supplementCurrency = res.supplementCurrency;
        })
        .then(() => {
          this.viewVisableDialog = true;
        });
    },
    myEdit: function(row) {
      this.tableDataDetail = [];
      this.formAdd = {
        supplementCurrency: {},
        details: []
      };
      this.tableOptionDetail.column[2].cell = true;
      this.editVisableDialog = true;
      getObj(row.id)
        .then(response => {
          let res = response.data.data;
          this.tableDataDetail = res.details;
          for (const item of this.tableDataDetail) {
            item.$cellEdit = true;
          }
          this.formAdd.supplementCurrency = res.supplementCurrency;
        })
        .then(() => {
          this.editVisableDialog = true;
        });
    },
    coinEdit: function(row) {
      this.tableDataDetail = [];
      this.formAdd = {
        supplementCurrency: {},
        details: []
      };
      this.tableOptionDetail.column[2].cell = true;
      this.editCoinVisableDialog = true;
      getSupplementCoinDetails(row.id)
        .then(response => {
          let res = response.data.data;
          this.tableDataDetail = res.details;
          for (const item1 of this.tableDataDetail) {
              item1.$cellEdit = true;
          }
          this.formAdd.supplementCurrency = res.supplementCurrency;
        })
        .then(() => {
          this.editCoinVisableDialog = true;
        });
    },
    paperEdit: function(row) {
      this.tableDataDetail = [];
      this.formAdd = {
        supplementCurrency: {},
        details: []
      };
      this.tableOptionDetail.column[2].cell = true;
      this.editPaperVisableDialog = true;
      getSupplementPaperDetails(row.id)
        .then(response => {
          let res = response.data.data;
          this.tableDataDetail = res.details;
          for (const item2 of this.tableDataDetail) {
              item2.$cellEdit = true;
          }
          this.formAdd.supplementCurrency = res.supplementCurrency;
        })
        .then(() => {
          this.editPaperVisableDialog = true;
        });
    },
    addchangeDialog: function() {
      if (this.addchangeDialogFlag) {
        this.addchangeDialogFlag = false;
      } else {
        this.addchangeDialogFlag = true;
      }
    },
    editchangeDialog: function() {
      if (this.editchangeDialogFlag) {
        this.editchangeDialogFlag = false;
      } else {
        this.editchangeDialogFlag = true;
      }
    },
    viewchangeDialog: function() {
      if (this.viewchangeDialogFlag) {
        this.viewchangeDialogFlag = false;
      } else {
        this.viewchangeDialogFlag = true;
      }
    },
    otherVueAction(){
      transitUtil.$on('updateReport_call_7',(param)=>{
        let p=param;
        getTvmSupplementCurrency(p).then(response => {
          this.tableData = response.data.data;
          this.tableLoading = false;
        })
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.bottom-menu {
  margin-top: 48px;
  text-align: center;
}
</style>
